require 'rubygems'
require 'test/unit'
require 'active_record'
require 'active_record/fixtures'
require 'active_support'

def load_schema
  # Connect to the database
  ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')

  # Load the schema
  load(File.dirname(__FILE__) + '/schema.rb')

  # Create the fixtures
  fixtures = ActiveRecord::Schema.tables
  fixtures.delete('schema_migrations')
  ActiveRecord::Fixtures.create_fixtures(File.dirname(__FILE__) + '/fixtures', fixtures)

  # Require Unveil
  require File.dirname(__FILE__) + '/../init'
end
